import { reactive, ref } from "vue";
import { getListApi as getAllCountryApi } from "@/api/configCenter/countryRegion";

export default function InitHook() {
  //表单数据
  const formState = reactive({
    countryRegionId: undefined //	国家地区代码
  });

  //等待状态
  const loading = ref<boolean>(false);

  //表单ref
  const formRef = ref(null);
  const getOptions = ref<any>();

  const getOptionsApi = () => {
    return getAllCountryApi({ status: 1, pageNum: 1, pageSize: 9999999, total: 0 }).then((res: any) => {
      const { records } = res.data;
      getOptions.value = records;
    });
  };

  return {
    formState,
    loading,
    formRef,
    getOptionsApi,
    getOptions
  };
}
